package com.example.demo.entity.dto;

import com.example.demo.verify.ParamValid;
import com.example.demo.common.constant.RuleCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Pattern;

/**
 * 注：尽量使用原有注解
 */
@Data
@ApiModel(description = "学生信息传参")
public class StudentDTO {
    @ApiModelProperty("学生姓名")
    @ParamValid(name = "姓名", rule = RuleCode.noWick)
    @Pattern(regexp = "是|否", message = "姓名必须为是或否")
    private String name;

    @ApiModelProperty("出生年龄")
    @ParamValid(name = "年龄", rule = RuleCode.num)
    @Range(min = 18, max = 35, message = "年龄必须在18~35岁之间")
    private String age;

    @ApiModelProperty("学生手机号")
    @ParamValid(name = "手机号", rule = RuleCode.mobile)
    private String mobile;
}
